Package-level declarations

Types

Link copied to clipboard

Convenience base class for WritableRagService implementations.

Link copied to clipboard

Traditional RAG. Text chunk

Link copied to clipboard
data class CompressionConfig(val enabled: Boolean = true)
Link copied to clipboard
Link copied to clipboard
interface ContentElement

Root of a hierarchy of content elements.

Link copied to clipboard

Root of a structured document

Link copied to clipboard
Link copied to clipboard
interface Embedded

Embedded object instance.

Link copied to clipboard
data class EnhancementEstimate(val expectedQualityGain: Double, val estimatedLatencyMs: Long, val estimatedTokenCost: Int, val recommendation: EnhancementRecommendation)
Link copied to clipboard
Link copied to clipboard
data class EntityCluster<E>(val anchor: E, val similar: List<<Error class: unknown class><E>>)

Cluster of similar entities

Link copied to clipboard

Generic retrieved entity

Link copied to clipboard
sealed interface ExplorationRequest
Link copied to clipboard
data class Fact(val assertion: String, val authority: String, val uri: String? = null, val metadata: Map<String, Any?> = emptyMap(), val id: String = UUID.randomUUID().toString()) : Source

A fact.

Link copied to clipboard

ContentElement that exists in a hierarchy, such as a document with sections and subsections.

Link copied to clipboard
data class LeafSection(val id: String, val uri: String? = null, val title: String, val text: String, val parentId: String? = null, val metadata: Map<String, Any?> = emptyMap()) : MaterializedSection, HasContent

Contains content

Link copied to clipboard

Entity mapped with JPA, Neo OGM or another persistence tool. Will be a JVM object. What it exposes beyond RetrievableEntity methods is a matter for the RagService in the application. MappedEntity objects have their own distinct types and can expose

Link copied to clipboard
Link copied to clipboard

Adds a name to the well known entity data.

Link copied to clipboard
@ApiStatus.Experimental
interface NavigableRagService : RagService

Rag service that supports navigation in a graph of retrievable objects. This may not be supported by all RAG services. It need not be a graph but could be implemented by a relational database or other structure.

Link copied to clipboard
Link copied to clipboard
data class QualityMetrics(val faithfulness: <Error class: unknown class>, val answerRelevancy: <Error class: unknown class>, val contextPrecision: <Error class: unknown class>, val contextRecall: <Error class: unknown class>, val contextRelevancy: <Error class: unknown class>, val overallScore: <Error class: unknown class> = computeRAGASScore( faithfulness, answerRelevancy, contextPrecision, contextRecall, contextRelevancy, ))

RAGAS quality metrics

Link copied to clipboard
data class RagRequest(val query: String, val similarityThreshold: <Error class: unknown class> = 0.8, val topK: Int = 8, val compressionConfig: CompressionConfig = CompressionConfig(), val labels: Set<String> = emptySet(), val timestamp: Instant = Instant.now()) : RagRequestRefinement

RAG request. Contains a query and parameters for similarity search.

Link copied to clipboard

Narrowing of RagRequest

Link copied to clipboard
data class RagResponse(val request: RagRequest, val service: String, val results: List<<Error class: unknown class><out Retrievable>>, val enhancement: RagResponseEnhancement? = null, val qualityMetrics: QualityMetrics? = null, val timestamp: Instant = Instant.now())

Rag response RagResponses can contain results from multiple RAG services. Results are not necessarily chunks, but can be entities.

Link copied to clipboard
data class RagResponseEnhancement(val enhancer: RagResponseEnhancer, val basis: RagResponse, val processingTimeMs: Long = 0, val tokensProcessed: Int = 0, val enhancementType: EnhancementType, val qualityImpact: <Error class: unknown class>? = null)
Link copied to clipboard
Link copied to clipboard
fun interface RagResponseFormatter

Implemented by classes that can format RagResponse objects into a string for inclusion in tool responses or prompts.

Link copied to clipboard
interface RagService

Central interface for Retrieval-Augmented Generation (RAG) services. Returns entities as well as text chunks.

Link copied to clipboard
Link copied to clipboard
data class RagServiceEnhancerProperties(val compressionLlm: <Error class: unknown class> = LlmOptions.withAutoLlm(), val rerankingLlm: <Error class: unknown class> = LlmOptions.withAutoLlm(), val maxConcurrency: Int = 12)
Link copied to clipboard
@ApiStatus.Experimental
interface RepositoryRagService : RagService

RagService comparable to a Spring Data repository.

Link copied to clipboard

A Retrievable object instance is a ContentElement (normally a chunk or an entity) that can be retrieved by RAG. It has a stable id.

Link copied to clipboard

Any retrievable entity, whether mapped or generic.

Link copied to clipboard
Link copied to clipboard
data class SimpleNamedEntityData(val id: String, val uri: String? = null, val name: String, val description: String, val labels: Set<String>, val properties: Map<String, Any>, val metadata: Map<String, Any?> = emptyMap()) : NamedEntityData
Link copied to clipboard

Sensible default RagResponseFormatter

Link copied to clipboard
sealed interface Source : Retrievable

A Source object instance is an input such as a Chunk or a Fact. It was provided to the system as data; it is not inferred by the system, but a direct piece of data.

Link copied to clipboard
interface Sourced

Implemented by objects that are from a source.

Link copied to clipboard

RagService that can accept documents

Functions

Link copied to clipboard
fun computeRAGASScore(faithfulness: Double, answerRelevancy: Double, contextPrecision: Double, contextRecall: Double, contextRelevancy: Double): Double